package org.example.library.service;

import lombok.extern.slf4j.Slf4j;
import org.example.library.entity.UserInfo;
import org.example.library.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Slf4j
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    /**
     * 验证密码是否正确
     * @param name
     * @param password
     * @return
     */
    public boolean checkPassword(String name,String password){
        UserInfo userInfo = userMapper.selectUserByName(name);
        if (userInfo == null){
            log.warn("用户信息不存在，name"+name);
            return false;
        }
        return userInfo.getPassword().equals(password);
    }
}
